package jdklearning.annotation;

import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedType;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;


public class TestInterfaceImpl implements TestInterface{

	
	public static void main(String[] args) {
//		Annotation[] annotations =
//		System.out.println(annotations.length);
		
		
//		AnnotatedType[] ds = TestInterfaceImpl.class.getAnnotatedInterfaces();
		AnnotatedType[] ds = TestInterface.class.getAnnotatedInterfaces();
		
		

		for(AnnotatedType a:ds) {
			System.out.println(a);
			Annotation[] annotations = a.getAnnotations();
			for(Annotation annotation : annotations) {
				System.out.println(annotation);
			}
		}
		
		Annotation[] annotations = TestInterface.class.getAnnotations();
//		Annotation[] annotations = TestInterfaceImpl.class.getAnnotations();
		for(Annotation annotation : annotations) {
			System.out.println(annotation);
		}
		
		System.out.println(Proxy.newProxyInstance(TestAnnotation.class.getClassLoader(), new Class[] {TestAnnotation.class}, new InvocationHandler() {
			
			@Override
			public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
				// TODO Auto-generated method stub
				System.out.println(proxy.getClass().getName());
				return null;
			}
		}) );
	}
}

